{{!
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}}
<div class="panel panel-default">
  <div class="panel-heading" {{action "onToggleBlock" category target="view"}}>
    <h3 class="panel-title">
      <i {{bindAttr class=":pull-right :panel-toggle view.category.isCollapsed:icon-angle-down:icon-angle-up"}}></i>
      <a class="panel-toggle category-header" {{QAAttr "category-header"}}>
        <span class="category-name" {{QAAttr "category-name"}}>{{view.category.displayName}}</span>
        {{#if view.category.errorCount}}
          <span class="alert-badge" {{QAAttr "error-badge"}}>
            <span class="counter label alerts-crit-count position-top">
              {{view.category.errorCount}}
            </span>
          </span>
        {{/if}}
      </a>
    </h3>
  </div>

  <div class="panel-body collapse in" {{bindAttr style="view.isCategoryBodyVisible"}} {{QAAttr "panel-body"}}>
  <div class="service-config-section">
    <form autocomplete="off" class="form-horizontal">
      {{#each configData in view.categoryConfigs}}
        {{#unless configData.isInDefaultTheme}} {{! configs related to default themes should not be shown on the Advanced tab }}
          {{#if configData.isComparison}}
            {{template "templates/common/configs/configs_comparison_row"}}
          {{else}}
            {{#unless controller.isCompareMode}}
              <div {{bindAttr class=":entry-row :form-group configData.isHiddenByFilter:hide configData.isOverridden:overridden-property configData.hasCompareDiffs:overridden-property"}} {{QAAttr "property-row"}}>
                {{#if configData.showLabel}}
                  {{#unless configData.rightSideLabel}}
                    <span {{bindAttr class="configData.errorMessage:has-error: :form-group :control-label-span :col-md-3"}}>
                  <label class="control-label" {{QAAttr "control-label"}}>
                    {{formatWordBreak configData.displayName}}
                    {{#if configData.isSecureConfig}}
                      <a href="javascript:void(null);">
                        <i class="glyphicon glyphicon-lock" rel="tooltip" data-toggle="tooltip" title="security knob"></i>
                      </a>
                    {{/if}}
                  </label>
                </span>
                  {{else}}
                    <span class="control-group control-label-span col-md-3"> </span>
                  {{/unless}}
                {{/if}}
                {{#if configData.isOriginalSCP}}
                  {{#if configData.rightSideLabel}}
                    <span {{bindAttr class="configData.isEditable::muted :col-md-3 :clear-left :form-group :control-label-span"}}>{{formatWordBreak configData.displayName}}</span>
                  {{/if}}
                {{/if}}
                <div class="col-md-9">
                  {{! Here serviceConfigBinding should ideally be serviceConfigPropertyBinding }}
                  {{#if configData.isOriginalSCP}}
                    <div {{bindAttr class="configData.errorMessage:has-error: configData.warnMessage:has-warning: :form-group"}} {{QAAttr "property-form-group"}}>
                      {{view configData.viewClass serviceConfigBinding="configData" categoryConfigsAllBinding="view.categoryConfigsAll" }}
                      {{#if configData.hintMessage}}
                        <a class="icon-question-sign glyphicon glyphicon-blue" href="#"
                           data-toggle="tooltip" {{bindAttr data-original-title="configData.hintMessage"}}></a>
                      {{/if}}
                      {{view App.ControlsView serviceConfigPropertyBinding="configData"}}
                      {{#if configData.errorMessage}}
                        <span class="help-block validation-block" {{QAAttr "validation-block"}}>{{configData.errorMessage}}</span>
                      {{/if}}
                      {{#if configData.warnMessage}}
                        <span class="has-warning">
                      <span class="help-block validation-block" {{QAAttr "validation-block"}}>{{configData.warnMessage}}</span>
                    </span>
                      {{/if}}
                    </div>
                  {{/if}}
                  {{#if configData.isOverridden}}
                    {{view App.ServiceConfigView.SCPOverriddenRowsView
                           serviceConfigPropertyBinding="configData"
                           isDefaultGroupSelectedBinding="controller.selectedConfigGroup.isDefault"
                    }}
                  {{/if}}
                </div>
              </div>
              {{#if configData.additionalView}}
                {{view configData.additionalView}}
              {{/if}}
            {{/unless}}
          {{/if}}
        {{/unless}}
      {{/each}}

      {{! For Advanced, Advanced Core Site, Advanced HDFS Site sections, show the 'Add Property' link.}}
      {{#isAuthorized "SERVICE.MODIFY_CONFIGS"}}
        {{#if view.canEdit}}
          {{#if view.category.customCanAddProperty}}
            <div>
              <a href="#" {{action "showAddPropertyWindow" this target="view" }} >{{t installer.step7.config.addProperty}}
                ...</a>
            </div>
          {{/if}}
        {{/if}}
      {{/isAuthorized}}
    </form>
  </div>
</div>
</div>
